package cate.game.play.skill.passive.hero;

import cate.common.table.d.GDAttr;
import cate.game.play.base.TargetFilterParam;
import cate.game.play.base.TargetSelector;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;
import cate.game.play.skill.FighterCD;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 出手时，为敌方攻击最高的1个单位附加【黄泉梦境】冷却3回合
 */
public class 黄泉梦境PH extends PassiveHandler {

	private int buff;

	private int 冷却回合;

	//buff=？？&冷却回合=？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		buff = args.getInt("buff", 0);
		冷却回合 = args.getInt("冷却回合", 0);
	}

	private int lastSettleRound;

	@Override
	public void onOwnerMoveDone(MoveCtx move, TimeActionCtx action) {
		if (FighterCD.inCD(lastSettleRound, 冷却回合, action.getRound().index)) {
			return;
		}
		lastSettleRound = action.getRound().index;
		Fighter one = TargetSelector.findOne(skill.owner, action.getTeamVs(), new TargetFilterParam().bigAttrSet(GDAttr.ATT));
		if (one != null) {
			one.buff.tryAddByTid(action, skill.owner, buff);
		}
	}
}
